{include file="public/header"}
<title>需求列表</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 充值管理
    <span class="c-gray en">&gt;</span> 充值金额列表
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="ch-row">
        <a class="ch-button ch-blue add "  href="javascript:;" title="新增">新增</a>
    </div>
    <div class="mt-20">
        <div class="title-border">
            <div class="flex1">序号</div>
            <div class="flex1">充值金额</div>
            <div class="flex1">操作</div>
        </div>
        {volist name='data' id='vo'}
        <div class="content-border">
            <div class="flex1">{$vo.jine_id}</div>
            <div class="flex1">{$vo.money}</div>
            <div class="flex1">
                <a class="ch-button ch-blue edit" data-id="{$vo.jine_id}" href="javascript:;" title="编辑"><span class="label label-primary">编辑</span></a>
                <a class="ch-button ch-red del" data-id="{$vo.jine_id}" href="javascript:;" title="删除"><span class="label label-danger">删除</span></a>
            </div>
        </div>
        {/volist}
        <div class="pages" style="float: right">{$data->render()}</div>

    </div>
</div>

{include file="public/footer"}
<script type="text/javascript">

    /**
     * 接单提醒
     */
    $('.add').click(function () {
        var winWidth = $(window).width();
        var areaWidth = "";
        var areaHeight = "";
        if( winWidth > 768 ){
            areaWidth = "400px"
            areaHeight = "200px"
        } else {
            areaWidth = '80%'
            areaHeight = '80%'
        }
        var id=$(this).attr('data-id');
        var src="{:Url('index/jine/add')}";
        layer.open({
            type: 2,
            area: [areaWidth, areaHeight],
            shade:0.4,
            title: '添加金额',
            content: src+'?fen='+id
        });
    });

    /**
     * 删除
     */
    $('.del').click(function () {
        var id=$(this).attr('data-id');
        var obj={};
        obj.jine_id=id;
        var src="{:Url('index/jine/del')}";
        layer.confirm('确认要删除吗？', function (index) {
            $.ajax({
                type: 'POST',
                url: src,
                dataType: 'json',
                data: obj,
                success: function (data) {
                    var res=JSON.parse(data);
                    if(res.code==200){
                        layer.msg(res.msg, {icon: 1, time: 2000}, function () {
                            setTimeout("window.location.reload()", 1);
                        });
                    }else{
                        layer.msg(res.msg,{icon: 5,time:1000});
                    }

                },
                error: function (data) {
                    console.log(data.msg);
                },
            });
        });
    });

    $('.edit').click(function () {
        var id=$(this).attr('data-id');
        var src="{:Url('index/jine/edit')}";
        layer.open({
            type: 2,
            area: ['30%', '30%'],
            fix: false,
            maxmin: true,
            shade:0.4,
            title: '编辑金额',
            content: src+'?jine_id='+id
        });
    });


</script>
</body>
</html>